//
//  main.swift
//  Array_Extension
//
//  Created by 伟宏 on 2019/10/6.
//  Copyright © 2019 伟宏. All rights reserved.
//

import Foundation

print("Hello, World!")

let a = [3, 1, 3, 1]

let bb = a.wh_Map { (index) -> Int in
    return index * 3
}

let cc = a.wh_filter { (index) -> Bool in
    return index > 2
}

let dd = a.wh_prefix { (index) -> Bool in
    return index > 2
}

let ccc = a.reduce("3") { (aaa, bbb) -> String in
    return "\(aaa)" + "\(bbb)"
}

let ddd = a.wh_reduce("3") { (aaa, bbb) -> String in
    return "\(aaa)" + "\(bbb)"
}



a.wh_forEach { (index) in
    print("foreach遍历", index)
}


print("wh_Map", bb)
print("wh_filter", cc)
print("wh_prefix", dd)
print(ccc)
print("a.wh_reduce",ddd)




